<?php

namespace App\Models;

use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class Dept extends BaseModel
{
   use SoftDeletes;
   public $table='sys_departments';

    public function children()
    {
        return $this->hasMany(Dept::class, 'parent_id');
    }

    public function childrenRecursive()
    {
        return $this->children()->with('childrenRecursive');
    }

    public function parent()
    {
        return $this->belongsTo(Dept::class, 'parent_id');
    }
}
